﻿using ModuleD;
using Prism.DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace ModuleLoadManual
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {

        }

        /// <summary>
        /// 手动模块加载配置,手动模块加载提供了更加灵活的模块加载方式.和moduleCatalog.AddModule<ModuleDProfile>()
        /// 方式是不同的,后者更加的简单,默认是使用模块类型名作为模块名,初始化模式默认在应用程序启动时加载.InitializationMode.WhenAvailable
        /// 如果你需要更加灵活的配置模块的加载策略,可以使用下面这种方式,比如延时加载某个模块,就可以使用下面这种方式.
        /// </summary>
        /// <param name="moduleCatalog"></param>
        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            var moduleDType = typeof(ModuleDProfile);
            moduleCatalog.AddModule(new ModuleInfo()
            {
                ModuleName = moduleDType.Name,
                ModuleType = moduleDType.AssemblyQualifiedName,
                InitializationMode = InitializationMode.OnDemand,
            });
        }
    }
}
